//
//  PageViewController.m
//  SDHuiYuShoping
//
//  Created by luojiao on 2017/4/18.
//  Copyright © 2017年 luojiao. All rights reserved.
//

#import "PageViewController.h"

@interface PageViewController ()

{
    NSTimer *timer;
    NSInteger time;
}
@end

@implementation PageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置返回按钮
    [self.backButton setImage:[UIImage imageNamed:@"back_white_btn"] forState:UIControlStateNormal];
    [self.backButton setImageEdgeInsets:UIEdgeInsetsMake(0, -50, 0, 0)];
    [self.backButton setTitle:@"返回" forState:UIControlStateNormal];
    [self.backButton setTitleEdgeInsets:UIEdgeInsetsMake(0, -40, 0, 0)];
    
    self.bgImage1.image = [FRUtils resizeImageWithImageName:@"yellow_bg"];
    self.bgImage2.image = [FRUtils resizeImageWithImageName:@"yellow_bg"];
    self.icon.image = [FRUtils resizeImageWithImageName:@"warning"];
    
    time = 60;
    timer = [NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(timerMethd) userInfo:nil repeats:YES];

}

- (void)timerMethd
{
    //天数计算
    long days = time/(24*3600);
    
    //小时计算
    long hours = time%(24*3600)/3600;
    
    //分钟计算
    long minutes = time%3600/60;
    
    //秒计算
    long second = time%60;
    self.timesLabel.text = [NSString stringWithFormat:@"距离现在：%ld天%ld小时%ld分%ld秒",days,hours,minutes,second];
    time --;
}
- (IBAction)backButton:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}





@end
